package controller;
import entidades.Inmueble; 
import entidades.Picture;
import java.util.LinkedList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import persistence.AccesoBD;

/**
 *
 * @author EOcampo
 */
public class GenerarHTMLBuscador extends GenerarHTMLGeneral {
    private LinkedList<Inmueble> lisInm;
    public GenerarHTMLBuscador(){}
    
    public String generarHTLMColumnOne(HttpServletRequest request, AccesoBD abd){
        String html=""; 
         if(request.getParameter("buscProp")!= null){
            try {
             String   ubic=(String)request.getParameter("ubicacion");
             String  tipo=(String)request.getParameter("inmueble");
             String  oper=(String)request.getParameter("operacion");
             //Inmueble inm =new Inmueble(ubic,oper,tipo);  
             //String condicion = "ubic=='"+inm.getUbicacion()+"' && tipo=='"+inm.getTipo()+"' && operacion=='"+inm.getOperacion()+"'";
             String condicion = "ubic=='"+ubic+"' && tipo=='"+tipo+"' && operacion=='"+oper+"'";

             lisInm=abd.listar(new Inmueble(),condicion);
            }catch (Exception e){
              System.out.print("asdasdas");     
            }
        }
        html+="<dic class=\"main_content\">\n";
        html+=  "<div class=\"column1\">\n";       
        html+=      "<div class=\"left_box\">\n";
        html+=          "<p>\n";
        html+=          "<p>\n";
        html+=          "<p>\n";
        html+=          "<p>\n";
        html+=          "<div class=\"top_left_box\"></div>\n";   
        html+=          "<div class=\"center_left_box\">\n";
        html+=              "<div class=\"box_title\"><span>Buscador</span> de propiedades :</div>\n";  
        html+=              "<div class=\"form\">\n";
        html+=                  "<p>&nbsp;</p>\n";
        /*Formulario Buscador De Propiedades*/
        html+="                 <form name=\"buscador\" action= \"Buscador.jsp\">\n";                 
        html+=                  "<div class=\"form_row_contact\">\n";
        html+=                      "<label class=\"adminleft\">Ubicaci&oacute;n<span>(*) </span>: </label>\n";
        html+=                      "<p>\n";
        html+=                          "<select name=\"ubicacion\" class=\"form_select\" style=\"width:160px\">\n";
        html+=                              "<option value=\"Macro-centro\">-----------------------------------</option>\n";//Valor por defecto(Macrocentro)
        html+=                              "<option value=\"Alberdi\">Alberdi</option>\n";
        html+=                              "<option value=\"BandaNorte\">Banda Norte</option>\n";
        html+=                              "<option value=\"Fenix\">Fenix</option>\n";
        html+=                              "<option value=\"Pizarro\">Pizarro</option>\n";
        html+=                              "<option value=\"Macro-centro\">Macro-Centro</option>\n";
        html+=                              "<option value=\"Micro-centro\">Micro-Centro</option>\n";
        html+=                          "</select>\n";
        html+=                      "</p>\n";
        html+=                      "<p>&nbsp;</p>\n";
        html+=                  "</div>\n";//div-47
        html+=                  "<div class=\"form_row_contact\">\n";
        html+=                      "<p>&nbsp;</p>\n";
        html+=                      "<label class=\"adminleft\">Inmueble<span>(*) </span>: </label>\n";
        html+=                      "<select name=\"inmueble\" class=\"form_select\"style=\"width:160px\">\n";
        html+=                          "<option value=\"Departamento\">-----------------------------------</option>\n";//Valor por defecto(casa)
        html+=                          "<option value=\"Departamento\">Departamento</option>\n";
        html+=                          "<option value=\"Casa\">Casa</option>\n";
        html+=                          "<option value=\"Oficina\">Oficina</option>\n";
        html+=                          "<option value=\"Local\">Local</option>\n";
        html+=                          "<option value=\"Salon\">Sal&oacute;n</option>\n";
        html+=                      "</select>\n";
        html+=                  "</div>\n";//div-62
        html+=                  "<div class=\"form_row_contact\">\n";
        html+=                      "<p>&nbsp;</p>\n";
        html+=                      "<label class=\"adminleft\">Operaci&oacute;n<span>(*) </span>: </label>\n";
        html+=                      "<select name=\"operacion\" class=\"form_select\"style=\"width:160px\">\n";
        html+=                          "<option value=\"Alquiler\">-----------------------------------</option>\n";//Valor por defecto(alquiler)
        html+=                          "<option value=\"Alquiler\">Alquiler</option>\n";
        html+=                          "<option value=\"Venta\">Venta</option>\n";
        html+=                      "</select>\n";
        html+=                  "</div>\n";//div-74
        html+=                  "<div style=\"float:right; padding:10px 25px 0 0;\">\n";
        html+=                      "<input type=\"submit\" name=\"buscProp\" src=\"images/find.gif\"/>\n";
        html+=                  "</div>\n";
        html+=                  "<p>&nbsp;</p>\n";        
        html+=              "</div>\n";//div-43
        html+=          "</div>\n";//div-41
        html+=          "<div class=\"bottom_left_box\"></div>\n";
        html+=      "</div>\n";//div-35
        html+=      "<div class=\"left_box\">\n";
        html+=          "<div class=\"admin_footer_help\">\n";
        html+=              "<span>(*)</span> Campos requeridos para buscar</p>\n";
        html+=              "<p>una propiedad</p>\n";
        html+=          "</div>\n";
        html+=      "</div> \n";
        html+=      "<p>&nbsp;</p>\n";
        html+=      "<div class=\"left_box\">\n";
        html+=          "<div class=\"top_left_box\"></div>\n"; 
        html+=          "<div class=\"center_left_box\">\n";
        html+=              "<div class=\"box_title\"><span>Informaci&oacute;n</span> de contacto :</div>\n";
        html+=              "<div class=\"form\">\n";
        html+=                  "<div class=\"form_row\">\n";
        html+=                      "<img src=\"images/contact_envelope.gif\" width=\"50\" height=\"47\" border=\"0\" class=\"img_right\" alt=\"\" title=\"\" />\n";
        html+=                      "<div class=\"contact_information\">\n";
        html+=                          "<p><strong>Email:</strong> martnieslatorre@gmail.com<br />\n";
        html+=                          "<p><strong>Tel&eacute;fono:</strong> 0358 462-2447 <p />\n";
        html+=                          "<strong>   Direcci&oacute;n:</strong> Mitre 1013 - Dpto A </p>\n";
        html+=                          "<p><strong>Fax:</strong> -- -- <p/>\n";
        html+=                              "<span>www.inmobiliaramartinezlatorre.com..ar</span>\n";
        html+=                          "</p>\n";
        html+=                          "</p>\n";
        html+=                      "</div>\n"    ;
        html+=                  "</div>\n";                    
        html+=              "</div>\n";
        html+=          "</div>\n";
        html+=          "<div class=\"bottom_left_box\"></div>\n";
        html+=      "</div>\n";         
        html+=  "</div>\n";//endOfColumnOne

        return html;
  }
    
    public String generarHTMLColumnFour(AccesoBD abd){
        LinkedList<Picture> picc =new LinkedList();
        String html="";
        html+=  "<div class=\"column4\">\n";
        html+=      "<div class=\"title\" style=\"float:left;\">\n";
        html+=         "<div style=\"float:left;\">Propiedades Disponibles</div>\n";
        html+=      "</div> \n"; 
        for (int i=0;i<=lisInm.size()-1;i++){
            String condicion="inm.id=="+lisInm.get(i).getId()+" && tipo=='portada'";
            picc=abd.listar(new Picture(),condicion);
            html+=      "<div class=\"offer_box_wide_style1\">\n";
            html+=          "<a href=\"DetallesProp.jsp\"><img src="+picc.getFirst().getPath()+" width=\"163\" height=\"138\" class=\"img_left\" alt=\"\" title=\"\" border=\"0\"/></a>\n";
            html+=          "<div class=\"offer_info\">\n";
            html+=              "<span>For Sale  150 000 $</span>\n";
            html+=              "<p class=\"offer\">\n";
            html+=                  picc.getFirst().getPath();
            html+=                  "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\n";             
            html+=              "</p>\n";
            html+=          "</div>\n";
            html+=          "<div class=\"more\">\n";
            html+=              "<p><a href=\"DetallesProp.jsp\">...more</a></p>\n";
            html+=          "</div>\n";
            html+=      "</div>\n";
        }
        html+=  "</div>\n";//endOfColumnFour;	
        html+="</div>\n";//endOfMainContent
     
        return html;
    }
}
